home *** CD-ROM | disk | FTP | other *** search
- /* getdfree.c --- p. 605 */
- #include <stdio.h>
- #include <dos.h>
- main()
- {
- unsigned long total_space, free_space,
- bytes_per_cluster;
- struct dfree dfinfo;
- getdfree(0, &dfinfo);
- if(dfinfo.df_sclus == -1)
- {
- printf("Error in getdfree\n");
- exit(0);
- }
- bytes_per_cluster = dfinfo.df_sclus * dfinfo.df_bsec;
- total_space = dfinfo.df_total * bytes_per_cluster;
- free_space = dfinfo.df_avail * bytes_per_cluster;
- printf("%ld bytes free out of %ld bytes of total "
- "space.\n", free_space, total_space);
- }